import logging
import os

from app.bot.utils.date_time import get_date_time


def configure_logging() -> None:

    logging.getLogger("aiohttp.access").setLevel(logging.WARNING)
    logging.getLogger("aiogram.event").setLevel(logging.WARNING)
    logging.getLogger("apscheduler.executors.default").setLevel(logging.ERROR)
    logging.getLogger("apscheduler.scheduler").setLevel(logging.ERROR)
    logging.getLogger("asyncssh").setLevel(logging.ERROR)
    logging.getLogger("asyncssh.sftp").setLevel(logging.ERROR)

    logging.basicConfig(
        filename="{0}/app/bot/logs/log-{1}.log".format(
            os.getcwd(), get_date_time("%Y-%m-%d")
        ),
        level=logging.INFO,
        format="%(filename)s:%(lineno)d #%(levelname)-8s [%(asctime)s] - %(name)s - %(message)s",
    )


log = logging.getLogger("bot")
